home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / misc / vpan100.zip / VPOUTBOX.H < prev    next >
C/C++ Source or Header  |  1995-01-18  |  4KB  |  120 lines

  1. //
  2. //   VIRTUAL PANELS * GRAPHIC USER UNTERFACE FOR LABORATORY WORKS
  3. //
  4. //        VPOUTBOX.H : CLASS: Outbox
  5. //
  6. //                       |     Written by O.Rasizade
  7. //    declarations       |        Sept 1992, 1993
  8. //                       |
  9. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  10.  
  11. #ifndef __cplusplus
  12. #error Must use C++ 
  13. #endif
  14.  
  15. #ifndef __VPOUTBOX_H
  16. #define __VPOUTBOX_H
  17.  
  18.  
  19.  
  20. #if !defined(__VPBOARD_H)
  21. #include "..\\vp\\vpboard.h"
  22. #endif
  23.  
  24. //+++++++++++++++++++++++++++++++++++++++++++++++++
  25. //++++++++++++ CLASS   << OUTBOX >>  +++++++++++++++
  26. //+++++++++++++++++++++++++++++++++++++++++++++++++
  27.  
  28. struct outboxcolors {COLORS
  29.            title,
  30.            text,
  31.            hltext,    //high-lighted text
  32.            paper;
  33.             };
  34.  
  35. const outboxcolors obxcoldflt={
  36.                RED,        // color of title
  37.                WHITE,        // text color
  38.                YELLOW,        //high-lighted text
  39.                LIGHTGRAY    // color of paper
  40.                };
  41.  
  42.     // Error Message Box Colors
  43. const plaquecolors errboxcolors={
  44.              RED,        // PlaqeColor
  45.              RED,        // shadow
  46.              LIGHTRED    // ltnd
  47.             };
  48. const outboxcolors errcolors={
  49.                WHITE,        // color of title
  50.                WHITE,        // text color
  51.                YELLOW,        //high-lighted text
  52.                RED        // color of paper
  53.                };
  54.  
  55. //------------------------------ Class declaration  --
  56.  
  57. class Outbox: public object ,public display
  58. {
  59.   int bkgnd;    // flag, if nonzero then backgr.color will be printed
  60.         //          for LEFT_TEXT
  61. protected:
  62.  
  63.   int textfont,textfontsize;
  64.   int xtextjust;    // x current text justify
  65.   int columns,rows;    // size of display
  66. //------- "Cursor" position are in pixels, not like text mode !
  67.   int xtext,ytext;    // "cursor" location in box rel. to paper coord.
  68.   int xtext0;        // LF location
  69.   int titlejustify;
  70.  
  71.   plaquecolors obxframecolors;    // colors of frame
  72.   outboxcolors obxcolors;
  73.  
  74.  public:
  75.  
  76.   //----- Constructor ------- All coord. and sizes in VGA pixels ----
  77.  Outbox(
  78.     int _x0,int _y0,// left top coord where to paint the box
  79.     objtype _type,    // may be FIXED,PERM,POPUP
  80.     char *_title,     // title
  81.     int columns,int rows,         // size of box
  82.                 //---------- Hereafter are defaults
  83.     int _frame=FRAMED,        // display may FRAMED or UNFRAMED
  84.     void (far *_paintproc)()=procNULL,// proc created by programmer
  85.                        // to repaint board, only for PERM
  86.     int  _titlefont=0,int _titlefontsize=1,    //font and size of title
  87.     int  _textfont=SMALL_FONT,int _textfontsize=5,    //font and size of text
  88.     plaquecolors obxcolcnfg=plaquecoldflt,  //colors of board
  89.     outboxcolors _obxcolors=obxcoldflt,
  90.     int _titlejustify=CENTER_TEXT);
  91.  
  92. virtual void  Paint(void);
  93.   void  SetTextJustify(text_just xtj=LEFT_TEXT);// justifies text
  94.                 // xtj may be LEFT_TEXT,CENTER_TEXT,RIGHT_TEXT
  95. virtual    void  cls(); //also initializes variables
  96.   void  GotoXY(int x,int y)    // sets cursor position
  97.     {xtext=x+xxspacing;                 // goto to bottom if y=-1
  98.      ytext=(y==-1)?yymaxp-yy0p-textheight("H")-yyspacing:y+yyspacing;}
  99.   void  GetXY(int *x,int *y)      // get cursor position
  100.             {*x=xtext;*y=ytext;}
  101.   void  SetTextColor(COLORS newcolor)
  102.             {obxcolors.text=newcolor;}
  103.   void  SetHLTextColor(COLORS newcolor)
  104.             {obxcolors.hltext=newcolor;}
  105.   void  YesBkgnd(void)
  106.             {bkgnd=1;}
  107.   void  NoBkgnd(void)
  108.             {bkgnd=0;}
  109.  
  110. // Print members print text bkgrnd only for LEFT_TEXT justify
  111.  
  112.     void  Put(char *text,int hilight=OFF);
  113.     void  Putn(char *text,int hilight=OFF);
  114.     int   Printf(int hilight, const char *fmt, ...);
  115.     int   Printfn(int hilight, const char *fmt, ...);
  116.  
  117. };//++++++++++++++ END of class Outbox+++++++++++++++++++
  118.  
  119. #endif // __VPOUTBOX_H
  120.